package com.buric.gateway.config;

import com.alibaba.csp.sentinel.datasource.ReadableDataSource;
import com.alibaba.csp.sentinel.datasource.nacos.NacosDataSource;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @author: zhou.wei
 * @description
 * @date: 2024/5/22 13:34
 */

@Configuration
public class SentinelConfig {



//    @PostConstruct
//    public void  init(){
//        ReadableDataSource<String, List<FlowRule>> flowRuleDataSource = new NacosDataSource<>("129.211.28.212:8848", "DEFAULT_GROUP", "sentinel-platform-gateway.json",
//                source -> JSON.parseObject(source, new TypeReference<List<FlowRule>>() {}));
//        FlowRuleManager.register2Property(flowRuleDataSource.getProperty());
//    }

}
